program B;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils,
  Math;

var
  f, g: TextFile;
  answer: Real;
  T: Word;
  N, X, Y: Integer;



procedure ReadData;
begin
  Readln(f, N, X, Y);
end;

function HexagonalNumber(n: Integer): Integer;
begin
  Result := n * ((n shl 1) - 1);
end;

function BinomialCoff(N, K: Cardinal): Cardinal;
var
  L: Cardinal;

begin
  if N < K then
    Result:= 0      // Error
  else begin
    if K > N - K then
      K:= N - K;    // Optimization
    Result:= 1;
    L:= 0;
    while L < K do begin
      Result:= Result * (N - L);
      Inc(L);
      Result:= Result div L;
    end;
  end;
end;

function CalculateProb(M, p, z: Integer): Real;
var
  i: Integer;
  bs: Int64;
begin
  //if M <= p shl 1 then begin
    bs := 0;
    for i := M downto z do
      Inc(bs, BinomialCoff(M, i));
    Result := bs / (1 shl M);
  {end else begin

  end;}
end;

procedure ProcessData;
var
  previousHexahonalIndex, hexahonalIndex, hexNum, previous, m, p, s, delta: Integer;
begin
  hexahonalIndex := Ceil((1 + sqrt(1 + 8 * n)) / 4);
  previousHexahonalIndex := trunc((1 + sqrt(1 + 8 * n)) / 4);
  hexNum := HexagonalNumber(hexahonalIndex);
  previous := HexagonalNumber(previousHexahonalIndex);
  if (N = hexNum) then begin
    if (abs(x) + y) shr 1 <= hexahonalIndex - 1 then
      answer := 1
    else
      answer := 0;
    Exit;
  end;
  if (N = hexNum - 1) then begin
    if (x = 0) and (y = (hexahonalIndex - 1) shl 1) then begin
      answer := 0;
      Exit;
    end;
    if (abs(x) + y) shr 1 <= hexahonalIndex - 1 then
      answer := 1
    else
      answer := 0;
    Exit;
  end;
  if (abs(x) + y) shr 1 <= previousHexahonalIndex - 1 then begin
    answer := 1;
    Exit;
  end;
  if (abs(x) + y) shr 1 > hexahonalIndex - 1 then begin
    answer := 0;
    Exit;
  end;
  m := N - previous;
  s := abs(x) + y;
  p := previousHexahonalIndex;
  if N = previous + 1 then begin
    if (y = 0) and (abs(x) = (hexahonalIndex - 1) shl 1)  then
      answer := 0.5
    else
      answer := 0;
    Exit;
  end;
  if (m <= p shl 1) then begin
    answer := CalculateProb(m, p, y + 1);
    Exit;
  end;
  if (m > p shl 1) then begin
    delta := m - p shl 1;
    if (y + 1 <= delta) then begin
      answer := 1;
      Exit;
    end;
    answer := CalculateProb(m - (delta shl 1), p, y + 1 - delta);
    Exit;

  end;




  //if (N = hexNum) or (N = hexNum - 1) then

  answer := 42;
end;


procedure OutputVerdict(casenum: Word);
begin
  writeln(g, 'Case #', casenum, ': ', answer:2:6);
  writeln('Case #', casenum, ': ', answer:2:6);
end;

var
  i: Word;
  s: String;

begin
  try
    s := ParamStr(1);
    if (s = '') then
       s := 'input.txt';
    AssignFile(f, s);
    Reset(f);
    AssignFile(g, 'output.txt');
    Rewrite(g);
    try
      Readln(f, T);
      for i := 1 to T do begin
        ReadData;
        ProcessData;
        OutputVerdict(i);
      end;
    finally
      CloseFile(f);
      CloseFile(g);
    end;
    writeln('Reading finished');
    Readln;
    { TODO -oUser -cConsole Main : Insert code here }
  except
    on E: Exception do begin
      Writeln(E.ClassName, ': ', E.Message);
      readln;
    end;
  end;
end.
